// pages/tabs/home/index.js
const gotop = require('../../../_pub/com/wx/gotop')
const { $wx, img, $http, target } = getApp()
const site = 'activity'
Page({
    data: {
        img,
        data:[]
    },
    /* -------------------------------------------------  */
    async paging(o){ await $http.paging(this, 'news', { query:{ news_type:'01', target }, ...o } ) },
    async auth(){
        await this.paging({ refresh:true })
    },
    /* -------------------------------------------------  */ 
    async onLoad(){ 
        this.friend = await $wx.share.friend(this, { param:{ site, target } })
        this.collect = await $wx.share.collect(this, { param:{ site, target  } })
        this.auth() 
     },
    onPullDownRefresh(){ $wx.refresh(this, 'auth')  },
    onUnload(){ $http.abort(this) },
    async onReachBottom() { await this.paging() },
    onPageScroll(e){ gotop.scroll(this, e) },
    /* -------------------------------------------------  */ 
    onShareAppMessage(e) { return $wx.share.msg(this, { param:{ site, target } }) },
    onShareTimeline(){ return this.friend },
    onAddToFavorites(){ return this.collect }
})